package com.jike.jkgame;

import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

public class AnimationDialog extends DialogFragment {

	// private GifView mView;
	private ImageView mView;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		
		getDialog().requestWindowFeature(STYLE_NO_TITLE);
		
		mView = (ImageView) inflater.inflate(R.layout.anim_layout, container, false);
		//mView.setGifImage(R.drawable.anim1);
		mView.setBackgroundResource(R.drawable.mission_anim);
		
		mView.post(new Runnable() {
			
			@Override
			public void run() {
				AnimationDrawable anim = (AnimationDrawable) mView.getBackground();
				anim.start();
			}
		});
		
		return mView;
	}

	@Override
	public void onDestroyView() {
		
		super.onDestroyView();
		// mView.destroy();
	}
	
	

}
